export default {
  intPartFormat: (value) => {
    let valueArray = String(value).split('.')
    let intPart = valueArray[0]
    return intPart
  },
  floatPartFormat: (value) => {
    let valueArray = String(value).split('.')
    let floatPart = '.00' // 预定义小数部分
    if (valueArray.length === 2) {
      floatPart = valueArray[1] // 拿到小数部分
      if (floatPart.length === 1) { // 补0
        return '.' + floatPart + '0'
      } else {
        return '.' + floatPart
      }
    } else {
      return floatPart
    }
  },
  filterRate: (value) => {
    return parseInt(value * 100) + '%'
  },
  filterYear: (value) => {
    return value.slice(0, -3)
  },
  filterMonth: (value) => {
    return value.slice(-2)
  },
  filterMonthOther: (value) => {
    if (value.indexOf('0') === 1) {
      return value.slice(-1)
    }
    return value.slice(-2)
  }
}
